﻿using ConfExpert.Forms.Base;
using ConfExpert.Utility;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Extensions;
using DevExpress.XtraEditors.Repository;

namespace ITaskManager.Forms.IT
{
    public partial class YaziciEnvanter : XForm
    {
        public YaziciEnvanter()
        {
            InitializeComponent();
        }

        private void YaziciEnvanter_Load(object sender, EventArgs e)
        {
            RepositoryItemComboBox riYazici = new RepositoryItemComboBox();
            riYazici.Items.AddRange(new object[] { "MonoCrome Yazıcı", "Renkli Yazıcı", "Çok Fonksiyonlu Yazıcı" });
            cbeYaziciTipi.Properties.Assign(riYazici);

            RepositoryItemComboBox riBaglantiTipi = new RepositoryItemComboBox();
            riBaglantiTipi.Items.AddRange(new object[] { "USB", "Ethernet", "Serial" });
            cbeBaglantiTipi.Properties.Assign(riBaglantiTipi);

            RepositoryItemComboBox riKagitBoyutu = new RepositoryItemComboBox();
            riKagitBoyutu.Items.AddRange(new object[] { "A3", "A4" });
            cbeKagitBoyutu.Properties.Assign(riKagitBoyutu);

            gleSirket.Properties.Assign(RI(Rp.Sirket));
            this.Shown += YaziciEnvanter_Shown;
            btnKaydet.ItemClick += btnKaydet_ItemClick;
        }

        void YaziciEnvanter_Shown(object sender, EventArgs e)
        {
            txtUrunAdi.Focus();
        }

        void btnKaydet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TAM.IT_EnvanterTableAdapter = new ITaskManager.Datasets.MyDataTableAdapters.IT_EnvanterTableAdapter();
            ITaskManager.Datasets.MyData.IT_EnvanterRow er = ds.IT_Envanter.NewIT_EnvanterRow();
            er.IT_EnvanterCesitId = gleEnvanterCesit.EditValue.ToInt();
            er.UrunAdi = txtUrunAdi.Text;
            er.SirketId = gleSirket.EditValue.ToInt();
            er.YaziciTipi = cbeYaziciTipi.EditValue.ToStr();
            er.BaglantiTipi = cbeBaglantiTipi.EditValue.ToStr();
            er.IPAdresi = txtIPAdres.Text;
            er.KartusTonerKodu = txtTonerKodu.Text;
            //er.OrtBaskiKapasitesi = numBaskıKalitesi.



        }
    }
}
